<%--
    Document   : rank
    Created on : Dec 12, 2009, 6:37:09 PM
    Author     : sclee
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.List" %>
<%@ page import="jhu.profiteer.data.Character" %>
<%@ page import="jhu.profiteer.data.CharacterJpaController" %>

<html>
  <%
    String pageTitle = "Ranking";
    String cssFile = "/profiteer-game/css/profiteer.css";
  %>
  <%@ include file="/WEB-INF/jspf/admin/header.jspf" %>
  <body>
    <%@ include file="/WEB-INF/jspf/title.jspf" %>
    <div class="contentArea Body">
      <div class="pagetitle">Administration</div>
      <div class="pagebody">
        <table>
          <tr>
            <td>
              <div class="divround">
                <h1>Current Ranking</h1>
                <%
                  CharacterJpaController cjc = new CharacterJpaController();
                  List<Character> ranking = (List<Character>)cjc.getCharactersSortedByMoney();

                  if((null == ranking) || (0 == ranking.size()))
                  {
                %>
                <p>No characters exist!</p>
                <%
                  }
                  else
                  {
                %>
                <table>
                  <tr>
                    <th id="left">Name</th>
                    <th id="left"><img src="/profiteer-game/images/gold.jpg" alt="gold" width="40" height="40"/></th>
                  </tr>
                  <%
                    for(Character c : ranking)
                    {
                  %>
                  <tr>
                    <td><%=c.getName()%></td>
                    <td><%=c.getMoney()%></td>
                  </tr>
                  <%
                    }
                  %>
                </table>
                <a href="/profiteer-game/index" >Back to Main Page</a>
                <%
                  }
                %>
              </div>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <%@ include file="/WEB-INF/jspf/footer.jspf" %>
  </body>
</html>
